package com.coco.goods;

import com.coco.common.util.IdWorker;
import org.mybatis.spring.annotation.MapperScan;
import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @Author: guofeng
 * @Date: 2021/07/14/18:52
 * @Description:
 */

@SpringBootApplication(scanBasePackages = "com.coco")
@EnableDiscoveryClient
@MapperScan("com.coco.goods.mapper")
@EnableFeignClients
@EnableSwagger2
public class CocoGoodsApplication {
    public static void main(String[] args) {
        SpringApplication.run(CocoGoodsApplication.class, args);
    }

    @Bean
    public IdWorker idWorker(){
        return new IdWorker();
    }

    @Bean
    public Redisson redisson(){
        Config config = new Config();
        config.useSingleServer().setAddress("redis://127.0.0.1:6379");
        return (Redisson) Redisson.create(config);
    }
}


